package cn.fx.feign;

import cn.fx.domain.Store;
import cn.fx.util.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StoreFallbackFactory implements FallbackFactory<StoreFeignClient> {

    // 此方法创建降级类
    @Override
    public StoreFeignClient create(Throwable throwable) {
        return new StoreFeignClient() {

            @Override
            public JsonResult save(Store store) {
                return JsonResult.me().setMsg("开启熔断");
            }

        };
    }
}
